import { stringify } from 'qs';
import request from '@/utils/request';
import {formDataCode} from '@/utils/utils';


// 获取发货管理列表
 export async function GetOrderList(params) {
      return request(`/${window.storeId}/OrderDeliver/GetOrderList?${stringify(params)}`);
}

// 获取批量发货记录列表
export async function ImportLog(params) {
    return request(`/${window.storeId}/OrderDeliver/ImportLog?${stringify(params)}`);
}

// 单个发货
export async function Delivery(params) {
    return request(`/${window.storeId}/OrderDeliver/Delivery`, {
      method: 'POST',
      body: {
        ...params
      }
    });
}

// 获取物流公司列表
export async function GetStoreExpressList(params) {
    return request(`/${window.storeId}/Express/GetStoreExpressList`);
}

// 获取发货地址列表
export async function GetSendAddrList(params) {
  return request(`/${window.storeId}/Express/GetSendAddrList`);
}

// 获取打印的订单列表
export async function GetOrderPrintList(params) {
  return request(`/${window.storeId}/OrderDeliver/GetOrderPrintList?${stringify(params)}`);
}

// 获取订单包裹列表
export async function GetPackageList(params) {
  return request(`/${window.storeId}/Express/GetPackageList?${stringify(params)}`);
}

// 标记订单为已打印发货单
export async function PrintedInvoice(params) {
  return request(`/${window.storeId}/OrderDeliver/PrintedInvoice`, {
    method: 'POST',
    body: {
      ...params
    }
  });
}
// 标记订单为已打印快递单
export async function PrintedCourierBill(params) {
  return request(`/${window.storeId}/OrderDeliver/PrintedCourierBill`, {
    method: 'POST',
    body: {
      ...params
    }
  });
}

// 获取打印选项配置
export async function GetPrintItemConfig(params) {
  return request(`/${window.storeId}/OrderDeliver/GetPrintItemConfig?${stringify(params)}`);
}

// 获取待发货列表信息
export async function GetOrderDeliverList(params) {
  return request(`/${window.storeId}/OrderDeliver/GetOrderDeliverList?${stringify(params)}`);
}

// 获取上一次打印快递单的发货地址、快递公司、快递单号
export async function GetPrintedCourierBill(params) {
  return request(`/${window.storeId}/OrderDeliver/GetPrintedCourierBill?${stringify(params)}`);
}

// 批量发货
export async function DeliveryBatch(params) {
    return request(`/${window.storeId}/OrderDeliver/DeliveryBatch`, {
      method: 'POST',
      body: {
        ...params
      }
    });
}

// 导入快递单
export async function ImportExpress(params) {       
    return request(`/${window.storeId}/OrderDeliver/ImportExpress`, {
      method: 'POST',     
    //   headers:{
    //     // "Content-Type" : "multipart/form-data" 
    //     credentials: 'omit'
    //   },
      body: params
    });
}

// 修改物流
export async function EditPackage(params) {       
  return request(`/${window.storeId}/Express/EditPackage`, {
    method: 'POST',       
    body: params
  });
}

